package com.tz.test.thread;

import com.tz.test.service.InsertDataHouseService;
import com.tz.test.vo.TransactionInfo;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @Author: qiuxiangjin
 * @Date: 2020/4/24
 */
@Slf4j
public class HandlerTask<T> implements Runnable {

    private TransactionInfo transactionInfo;
    private List<T> partitionList;
    private InsertDataHouseService<T> insertDataHouseService;

    public HandlerTask(TransactionInfo transactionInfo , List<T> partitionList , InsertDataHouseService<T> insertDataHouseService){
        this.transactionInfo = transactionInfo;
        this.partitionList = partitionList;
        this.insertDataHouseService = insertDataHouseService;
    }


    @Override
    public void run() {
        try {
            log.info("HandleTask start");
            insertDataHouseService.saveData(transactionInfo, partitionList);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
